#pragma once
#include "space_hash_cpu.h"

namespace PhysLeo
{

/**
 * gpu version of space hash.
 * automatically detect the bouding box of a point set, output the neighbor list accoding to the min and max neighbor radius.
 * If there are more than SPACE_HASH_NEIGHBOR_MAX points in a point's neighbor list, it will only store the closest.
 * warning: it should be noticed, when the point set are distributed unevenly, you may get a incorrect result by this method. Because points may overflow in one grid.
 * however in our discretization, point set will be distributed evenly.
 */    
template<typename T>
class SpaceHashCuda:public SpaceHashCpu<T>
{
public:
    void setSpace(T resolution, glm::tvec3<T> low, glm::tvec3<T> high, int np_max) override;
    void constructHashTable(std::shared_ptr<BufferData<glm::tvec3<T>>> ptr_pos) override;

    void queryNeighbor(std::shared_ptr<BufferData<glm::tvec3<T>>> ptr_pos, std::shared_ptr<BufferData<NeighborList>> ptr_neighbor_list, T max_radius, T min_radius) override;
};

}